package com.ibm.commerce.url.tooling;

import com.ibm.commerce.url.tasks.accelerator.*;
import com.ibm.commerce.url.tasks.cmc.CMCLogon;
import com.ibm.commerce.url.exception.*;
import com.ibm.wc.test.exception.DatablockMissingException;

public class Accelerator extends URLTooling {
//	private static Accelerator instance = new Accelerator();
	
	private Accelerator(){}
	
//	public static Accelerator getInstance(){
//		return instance;
//	}
	
//	public void logon() throws TaskFailException {
//		AcceleratorLogon.getInstance().runTask();
//	}
//	
//	public void logon(int inputIndex) throws TaskFailException {
//		AcceleratorLogon.getInstance().setCounterIndex(inputIndex);
//		AcceleratorLogon.getInstance().runTask();
//	}
	
	/**
	 * All the inputs required by tasks inside should be passed before invoking
	 * @throws DatablockMissingException 
	 */
	public static void logon(String logonName, String logonPassword) throws TaskFailException, NullPointerException, DatablockMissingException {
		if(logonName==null || logonPassword==null){
			throw new NullPointerException("logonName or passWord is null!");
		}
		
		browserContext.addInputParam(CMCLogon.INPUT_PARAMETER_NAME_LOGONID, logonName);
		browserContext.addInputParam(CMCLogon.INPUT_PARAMETER_NAME_LOGONPASSWORD, logonPassword);
		
		AcceleratorLogon.execute();
	}
	
}
